$(document).ready(function(){
    $('.req .imp').click(function(){
   $(this).requestClick({msg: "request successfuly canceled", newClass: "error-row"});
});

    $('.req .acc').click(function(){
   $(this).requestClick({msg: "request successfuly accepted", newClass: "success-row"});
});

$.fn.requestClick = function(){
    
     var args = arguments[0] || {};
     var msg = args.msg;
     var newClass = args.newClass;
   $(this).parent().animate({
    opacity: 0.2,
   },
   1000,
   function(){
    $(this).addClass(newClass);
    $(this).text(msg);
    $(this).animate({opacity: 1},1000);
   });
}
});